home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / pack / xpklibs / xpk_unpack.s < prev    next >
Text File  |  1980-01-03  |  1KB  |  67 lines

  1.         incdir    _include:
  2.         include    exec/exec.i
  3.         include    libraries/dos_lib.i
  4.         include    libraries/exec_lib.i
  5.         include    libraries/dosextens.i
  6.         include    include:libraries/xpk.i
  7.  
  8. start:        move.l    4.w,a6
  9.         lea    xpkname(pc),a1
  10.         jsr    _LVOOldOpenLibrary(a6)
  11.         move.l    d0,xpkbase        ; Store XPK Library base!
  12.         beq.b    cleanup            ; ERROR -> Exit
  13.  
  14.         move.l    d0,a6            ; XPKBase to A6
  15.         lea    tags(pc),a0
  16.         jsr    _LVOXpkUnpack(a6)
  17.         tst.l    d0
  18.         beq.w    noerror
  19.  
  20.         suba.l    a0,a0
  21.         bra.s    yoyo
  22.  
  23. noerror        move.l    fileptr(pc),a0
  24.         move.l    a0,0.w
  25.  
  26. yo        btst    #6,$bfe001
  27.         bne.s    yo
  28.  
  29. yoyo        
  30.  
  31. cleanup        move.l    fileptr(pc),d0
  32.         beq.b    s1
  33.         move.l    d0,a1
  34.         move.l    fileptrlen(pc),d0
  35.         move.l    4.w,a6
  36.         jsr    _LVOFreeMem(a6)        ; Free XPK output buffer
  37.  
  38. s1        move.l    xpkbase(pc),d0
  39.         beq.b    exit            ; Library not open
  40.         move.l    d0,a1
  41.         jsr    _LVOCloseLibrary(a6)    ; Close XPK library
  42.  
  43. exit        moveq    #0,d0            ; No error code!
  44.         rts
  45.  
  46.  
  47. xpkbase:    dc.l    1
  48.  
  49. tags:        dc.l    XPK_InName,filename        ; The file name to be read
  50.         dc.l    XPK_GetError,errbuf        ; A pointer to the error message buffer
  51.         dc.l    XPK_GetOutBuf,fileptr        ; Sets a pointer to the output buffer
  52.         dc.l    XPK_GetOutLen,filesize        ; Sets the number of bytes written
  53.         dc.l    XPK_GetOutBufLen,fileptrlen    ; Sets the length of the output buffer
  54.         dc.l    XPK_PassThru,-1            ; Will pass through uncompressed data
  55.         dc.l    TAG_DONE
  56.  
  57. fileptr:    ds.l    1
  58. filesize:    ds.l    1
  59. fileptrlen:    ds.l    1
  60. errbuf:        ds.b    82
  61.         even
  62. dosname:    dc.b    'dos.library',0
  63. xpkname:    dc.b    'xpkmaster.library',0
  64. filename:    dc.b    'work:vars3.c',0
  65.         even
  66.         end
  67.